package com.chinafocus.gc;

import lombok.extern.slf4j.Slf4j;

/**
 * @author wd
 * @version 1.0
 * @date 2020/6/19
 * @Description 栈层级不足探究
 * -Xss2m 设置栈帧大小
 *
 */
@Slf4j
public class StackOverFlow {
    private int i;

    public static void main(String[] args) {
        StackOverFlow stackOverFlow = new StackOverFlow();
        try {
            stackOverFlow.plus();
        } catch (Exception e) {
            System.out.println("Exception:stack length:" + stackOverFlow.i);
            e.printStackTrace();
        } catch (Error e) {
            System.out.println("Error:stack length:" + stackOverFlow.i);
            e.printStackTrace();
        }
    }

    public void plus() {
        i++;
        log.info(String.valueOf(i));
        plus();
    }
}

